<h1><code ng:non-bindable="">ngSwitch</code>
<span class="hint">(directive in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/directive/ngSwitch.js"
        class="improve-docs btn btn-primary">Improve this doc</a>

    <h2 id="Description">Description</h2>

    <div class="description">
        <div class="ng-directive-page ng-directive-ngswitch-page"><p>Conditionally change the DOM structure.</p></div>
    </div>
    <h2 id="Usage">Usage</h2>

    <div class="usage">This directive can be used as custom element, but be aware of <a href="guide/ie">IE
        restrictions</a>.<pre><code ng:non-bindable="">&lt;ANY ng-switch="expression"&gt;
        &lt;ANY ng-switch-when="matchValue1"&gt;...&lt;/ANY&gt;
        &lt;ANY ng-switch-when="matchValue2"&gt;...&lt;/ANY&gt;
        ...
        &lt;ANY ng-switch-default&gt;...&lt;/ANY&gt;
        &lt;/ANY&gt;</code>
</pre>
        <h3 id="Directive.info">Directive info</h3>

        <div class="directive-info">
            <ul>
                <li>This directive creates new scope.</li>
            </ul>
        </div>
        <h3 id="Parameters">Parameters</h3>
        <ul class="parameters">
            <li><code ng:non-bindable="">ngSwitch|on – {*} – </code>

                <div class="ng-directive-page ng-directive-ngswitch-page"><p>expression to match against <tt>ng-switch-when</tt>.
                </p></div>
            </li>
        </ul>
    </div>
    <h2 id="Example">Example</h2>

    <div class="example">
        <div class="ng-directive-page ng-directive-ngswitch-page"><h4>Source</h4>

            <div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-179"
                 source-edit-css="" source-edit-js="script.js-178" source-edit-unit=""
                 source-edit-scenario="scenario.js-180"></div>
            <div class="tabbable">
                <div class="tab-pane" title="index.html">
                    <pre class="prettyprint linenums" ng-set-text="index.html-179"
                         ng-html-wrap=" angular.js script.js"></pre>
                    <script type="text/ng-template" id="index.html-179">

                        <div ng-controller="Ctrl">
                            <select ng-model="selection" ng-options="item for item in items">
                            </select>
                            <tt>selection={{selection}}</tt>
                            <hr/>
                            <div ng-switch on="selection">
                                <div ng-switch-when="settings">Settings Div</div>
                                <span ng-switch-when="home">Home Span</span>
                                <span ng-switch-default>default</span>
                            </div>
                        </div>
                    </script>
                </div>
                <div class="tab-pane" title="script.js">
                    <pre class="prettyprint linenums" ng-set-text="script.js-178"></pre>
                    <script type="text/ng-template" id="script.js-178">
                        function Ctrl($scope) {
                        $scope.items = ['settings', 'home', 'other'];
                        $scope.selection = $scope.items[0];
                        }
                    </script>
                </div>
                <div class="tab-pane" title="End to end test">
                    <pre class="prettyprint linenums" ng-set-text="scenario.js-180"></pre>
                    <script type="text/ng-template" id="scenario.js-180">
                        it('should start in settings', function() {
                        expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Settings Div/);
                        });
                        it('should change to home', function() {
                        select('selection').option('home');
                        expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Home Span/);
                        });
                        it('should select deafault', function() {
                        select('selection').option('other');
                        expect(element('.doc-example-live [ng-switch]').text()).toMatch(/default/);
                        });
                    </script>
                </div>
            </div>
            <h4>Demo</h4>

            <div class="well doc-example-live" ng-embed-app="" ng-set-html="index.html-179"
                 ng-eval-javascript="script.js-178"></div>
        </div>
    </div>
</div>
